import React from 'react'
import { useEffect } from 'react'
import { useState } from 'react'

export default function App() {

  let [opacity,setOpacity]=useState(1)

  useEffect(()=>{
      const setOpacitys = setInterval(()=>{
        opacity -= 0.1
        if(opacity <= 0){
          opacity=1
        }
        setOpacity(opacity)
        return ()=>{
          clearInterval(setOpacitys)
        }
      },100)
  },[])



  return (
    <div>
      <h1 style = {{opacity}}>React 真好用</h1>
    </div>
  )
}



